package 力扣;

public class 山脉数组 {
    public static void main(String[] args) {
        int[] A={0,3,2,1};
        boolean b = validMountainArray(A);
        System.out.println(b);
    }
    public static  boolean validMountainArray(int[] A) {
          if (A.length<3){
              return false;
          }
          int i=0;
          int j=A.length-1;
          while (i<A.length-1){
              if (A[i]<A[i+1]){
                  i++;
              }
              else
                  break;
          }
          while (j>0){
              if (A[j]<A[j-1])
                  j--;
              else
                  break;
          }
          return i!=A.length-1 && j!=0 && i==j;
        }

    }

